package com.sunrise.xdoc.entity.config;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.sunrise.xdoc.entity.AbstractCodeEntity;

@Entity
@Table(name = "config_ban")
@Inheritance(strategy = InheritanceType.JOINED)
public class Ban extends AbstractCodeEntity {
	private static final long serialVersionUID = -5284799243435617565L;
	private String name;
	private KhuVuc khuVuc;
	private Integer soChoNgoi;

	@Column(name = "name", unique = true)
	@Length(max = 250)
	@NotBlank(message = "Chưa điền tên bàn")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@ManyToOne
	@JoinColumn(name = "khu_vuc_id")
	public KhuVuc getKhuVuc() {
		return khuVuc;
	}

	public void setKhuVuc(KhuVuc khuVuc) {
		this.khuVuc = khuVuc;
	}

	@Column(name = "so_cho_ngoi")
	@Max(value = 100, message = "Số chỗ ngồi không được lớn hơn 100")
	@Min(value = 1, message = "Số chỗ ngồi chưa đúng")
	public Integer getSoChoNgoi() {
		return soChoNgoi;
	}

	public void setSoChoNgoi(Integer soChoNgoi) {
		this.soChoNgoi = soChoNgoi;
	}

}
